﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.Flexibles.CApCableRotatingSlidingAttachmentControl
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.Flexibles;

public class CApCableRotatingSlidingAttachmentControl : 
  UserControl,
  ICUiFLEXAttachmentEditControl,
  IComponentConnector
{
  internal Border RotatingSlidingAttachmentBorder;
  internal Canvas CanvasRotatingSlidingAttachment;
  internal Path BackgroundLayerRotatingSliding;
  internal Canvas EndFrameAxesRotatingSliding;
  internal Canvas EndFramePointerRotatingSliding;
  internal TextBlock EndFrameLabelRotatingSliding;
  internal Canvas StartFrameAxesRotatingSliding;
  internal Canvas StartFramePointerRotatingSliding;
  internal TextBlock StartFrameLabelRotatingSliding;
  internal Canvas AttachmentFramePointerRotatingSliding;
  internal TextBlock AttachmentFrameLabelRotatingSliding;
  internal Canvas AttachmentFrameAxesRotatingSliding;
  internal Path AttachmentXAxisLineRotatingSliding;
  internal Path AttachmentXAxisArrowRotatingSliding;
  internal Path AttachmentYAxisLineRotatingSliding;
  internal Path AttachmentYAxisArrowRotatingSliding;
  internal Path AttachmentAnyAxisLineRotatingSliding;
  internal Path AttachmentAnyAxisArrowRotatingSliding;
  internal Path CableSimulatedSection1RotatingSliding;
  internal Path CableSimulatedSection2RotatingSliding;
  internal Grid RotationArrowRotatingSliding;
  internal Path RotationArrowLeftLineRotatingSliding;
  internal Path RotationArrowLeftCapRotatingSliding;
  internal Path RotationArrowRightLineRotatingSliding;
  internal Path RotationArrowRightCapRotatingSliding;
  internal Path DistanceFromStartFocusRotatingSliding;
  internal Path DistanceFromStartPathRotatingSliding;
  internal Canvas DistanceFromStartPointerRotatingSliding;
  internal TextBlock DistanceFromStartLabelRotatingSliding;
  internal Rectangle AttachmentGraphicObjectRotatingSliding;
  internal Canvas AttachmentAxesZoomPanelRotatingSliding;
  internal Canvas AttachmentAxesFrameIndicationRotatingSliding;
  internal Canvas AttachmentAxesDiagramIndicationRotatingSliding;
  internal Path AttachmentXAxisBackgroundRotatingSliding;
  internal Path AttachmentYAxisBackgroundRotatingSliding;
  internal Ellipse MiniCableBackgroundEllipseBackRotatingSliding;
  internal Ellipse MiniCableHolderBackRotatingSliding;
  internal Path MiniCableShapeFillerRotatingSliding;
  internal Path MiniCableRightEdgeRotatingSliding;
  internal Path MiniCableLeftEdgeRotatingSliding;
  internal Ellipse MiniCableHolderFrontRotatingSliding;
  internal Ellipse MiniCableBackgroundEllipseFrontRotatingSliding;
  internal Ellipse MiniCableForegroundEllipseRotatingSliding;
  internal Canvas AttachmentZAxisEllipticalArrowRotatingSliding;
  internal Ellipse MiniCableForegroundEllipticalArrowRotatingSliding;
  internal Path MiniCableForegroundEllipticalArrowStartTipRotatingSliding;
  internal Path MiniCableForegroundEllipticalArrowEndTipRotatingSliding;
  internal Canvas AttachmentXAxisForegroundRotatingSliding;
  internal Canvas AttachmentXAxisEllipticalArrowRotatingSliding;
  internal Canvas AttachmentYAxisForegroundRotatingSliding;
  internal Canvas AttachmentYAxisEllipticalArrowRotatingSliding;
  internal Canvas AttachmentXArrowRotatingSliding;
  internal TextBlock AttachmentXAxisLabelRotatingSliding;
  internal Canvas AttachmentYArrowRotatingSliding;
  internal TextBlock AttachmentYAxisLabelRotatingSliding;
  internal Canvas AttachmentZArrowRotatingSliding;
  internal Canvas HitBoxesRotatingSliding;
  internal Canvas DistanceFromStartHitBoxRotatingSliding;
  internal Canvas AttachmentFrameHitBoxRotatingSliding;
  internal Path AttachmentFrameZoomHitBoxRotatingSliding;
  internal Canvas RotationAxisHitBoxRotatingSliding;
  internal Rectangle RotationAxisZoomHitBoxRotatingSliding;
  internal StackPanel RotatingSlidingAttachmentPanel;
  internal Grid RotatingSlidingAttachmentGrid;
  internal TextBlock RotatingSlidingAttachmentFrameLabel;
  internal TxObjEditBoxControl RotatingSlidingAttachmentFrameBoxCtrl;
  internal TextBlock RotatingSlidingDistanceFromStartLabel;
  internal TxNumericEditBoxControl RotatingSlidingDistanceFromStartTxNumericEditBox;
  internal TextBlock RotatingSlidingRotationAxisLabel;
  internal ComboBox RotatingSlidingRotationAxisCombo;
  private bool _contentLoaded;

  public event ParameterChangeEventHandler ParameterChanged;

  public new string Name { get; set; }

  public CApFlexParameterController ParameterController { get; set; }

  public CApCableAttachmentStatusAnalysis CableAttachmentStatusAnalysis { get; set; }

  public TxObjEditBoxControl FrameEditBoxCtrlAttachment
  {
    get => this.RotatingSlidingAttachmentFrameBoxCtrl;
  }

  public ICApFLEXCableAttributeViewModel AttributeViewModel { get; private set; }

  public CApFLEXCableAttachmentViewModel AttachmentViewModel { get; private set; }

  public CApFLEXAttachmentEditorViewModel EditorViewModel
  {
    get => (CApFLEXAttachmentEditorViewModel) this.RotatingSlidingAttachmentEditorViewModel;
  }

  public CApFLEXRotatingSlidingAttachmentEditorViewModel RotatingSlidingAttachmentEditorViewModel { get; }

  public List<Storyboard> AttachmentStoryboards
  {
    get
    {
      return new List<Storyboard>(5)
      {
        this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachment") as Storyboard,
        this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachmentZoomOnX") as Storyboard,
        this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachmentZoomOnY") as Storyboard,
        this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachmentZoomOnZ") as Storyboard,
        this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachmentZoomOnNone") as Storyboard
      };
    }
  }

  public Storyboard ActiveAttachmentStoryboard
  {
    get
    {
      Storyboard resource = this.CanvasRotatingSlidingAttachment.FindResource((object) "PreviewRotatingSlidingAttachment") as Storyboard;
      if (this.IsZoomPanelVisible)
      {
        string resourceKey;
        switch (this.AttachmentViewModel.RotatingSlidingRotationAxis)
        {
          case CApFLEXRotatingSlidingAttachmentRotationAxis.X:
            resourceKey = "PreviewRotatingSlidingAttachmentZoomOnX";
            break;
          case CApFLEXRotatingSlidingAttachmentRotationAxis.Y:
            resourceKey = "PreviewRotatingSlidingAttachmentZoomOnY";
            break;
          case CApFLEXRotatingSlidingAttachmentRotationAxis.Z:
            resourceKey = "PreviewRotatingSlidingAttachmentZoomOnZ";
            break;
          case CApFLEXRotatingSlidingAttachmentRotationAxis.None:
            resourceKey = "PreviewRotatingSlidingAttachmentZoomOnNone";
            break;
          default:
            throw new NotImplementedException();
        }
        resource = this.CanvasRotatingSlidingAttachment.FindResource((object) resourceKey) as Storyboard;
      }
      return resource;
    }
  }

  public Shape SimulatedShape => (Shape) this.CableSimulatedSection2RotatingSliding;

  private CApCableAttachmentFrameController AttachmentFrameController { get; set; }

  private CApCableAttachmentFrameUpdater AttachmentFrameUpdater { get; set; }

  private CApCableAttachmentLengthFromStartUpdater LengthFromStartUpdater { get; set; }

  private TxNumericEditBoxControl LastFocusedNumericBox { get; set; }

  private ComboBox LastFocusedComboBox { get; set; }

  private bool IsControlLoading => this.EditorViewModel.IsControlLoading;

  private bool IsControlActivated => this.EditorViewModel.IsControlActivated;

  private bool IsZoomPanelVisible
  {
    get => this.RotatingSlidingAttachmentEditorViewModel.IsZoomPanelVisible;
    set => this.RotatingSlidingAttachmentEditorViewModel.IsZoomPanelVisible = value;
  }

  public CApCableRotatingSlidingAttachmentControl()
  {
    this.RotatingSlidingAttachmentEditorViewModel = new CApFLEXRotatingSlidingAttachmentEditorViewModel();
  }

  public void InitControl(
    ICApFLEXCableAttributeViewModel attributeViewModel,
    CApFLEXCableAttachmentViewModel attachmentViewModel,
    CApFLEXFrameValidator frameValidator,
    bool isCreationMode,
    CApFlexParameterController parameterController,
    CApCableAttachmentStatusAnalysis cableAttachmentStatusAnalysis,
    CApCableAttachmentFrameController attachmentFrameController)
  {
    this.AttributeViewModel = attributeViewModel;
    this.AttachmentViewModel = attachmentViewModel;
    this.ParameterController = parameterController;
    this.CableAttachmentStatusAnalysis = cableAttachmentStatusAnalysis;
    this.AttachmentFrameController = attachmentFrameController;
    this.InitializeComponent();
    this.RegisterNumericalControlEvents();
    this.InitFixedFrameEditBox(frameValidator, isCreationMode);
    this.InitRotationAxisCombo();
    this.UpdateRotationAxisCombo(this.AttachmentViewModel.RotatingSlidingRotationAxis);
    this.UpdateLabelText();
    this.SetBindings();
  }

  private void InitFixedFrameEditBox(CApFLEXFrameValidator frameValidator, bool isCreationMode)
  {
    this.RotatingSlidingAttachmentFrameBoxCtrl.ValidatorType = (TxValidatorType) 6;
    this.RotatingSlidingAttachmentFrameBoxCtrl.SetValidator((ITxValidator) frameValidator);
    this.RotatingSlidingAttachmentFrameBoxCtrl.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.AttachmentFrameEditBoxCtrl_Picked);
    if (!isCreationMode)
      this.RotatingSlidingAttachmentFrameBoxCtrl.Object = (ITxObject) this.AttachmentViewModel.FixedFrame;
    ((UIElement) this.RotatingSlidingAttachmentFrameBoxCtrl).KeyUp += new KeyEventHandler(this.RotatingSlidingAttachmentFrame_KeyUp);
    this.AttachmentFrameUpdater = new CApCableAttachmentFrameUpdater(this.RotatingSlidingAttachmentFrameBoxCtrl, this.AttachmentFrameController, this.AttributeViewModel, this.AttachmentViewModel);
    this.LengthFromStartUpdater = new CApCableAttachmentLengthFromStartUpdater(this.RotatingSlidingDistanceFromStartTxNumericEditBox, this.AttributeViewModel, this.AttachmentViewModel);
  }

  private void InitRotationAxisCombo()
  {
    ComboBox rotationAxisCombo = this.RotatingSlidingRotationAxisCombo;
    ObservableCollection<CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem> observableCollection = new ObservableCollection<CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem>();
    observableCollection.Add(new CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem(CApFLEXStringTable.AttachmentRotationAxisX, CApFLEXRotatingSlidingAttachmentRotationAxis.X));
    observableCollection.Add(new CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem(CApFLEXStringTable.AttachmentRotationAxisY, CApFLEXRotatingSlidingAttachmentRotationAxis.Y));
    observableCollection.Add(new CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem(CApFLEXStringTable.AttachmentRotationAxisZ, CApFLEXRotatingSlidingAttachmentRotationAxis.Z));
    observableCollection.Add(new CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem(CApFLEXStringTable.AttachmentRotationAxisNone, CApFLEXRotatingSlidingAttachmentRotationAxis.None));
    rotationAxisCombo.ItemsSource = (IEnumerable) observableCollection;
  }

  public void SetUpStoryboardsParameters()
  {
    List<Storyboard> attachmentStoryboards = this.AttachmentStoryboards;
    for (int index = 0; index < attachmentStoryboards.Count; ++index)
    {
      attachmentStoryboards[index].SpeedRatio = 1.0;
      attachmentStoryboards[index].AutoReverse = false;
    }
  }

  public void UpdateLabelText() => this.UpdateLinearUnitText();

  public void UpdateLinearUnitText()
  {
    this.RotatingSlidingDistanceFromStartLabel.Text = CApFLEXStringTable.AttachmentLengthLabel + CApCableUtility.LinearUnitLabelText();
  }

  public void UpdateAttachmentCtrlBox()
  {
    this.RotatingSlidingAttachmentFrameBoxCtrl.Text = "";
    this.RotatingSlidingAttachmentFrameBoxCtrl.Object = (ITxObject) this.AttachmentViewModel.FixedFrame;
    if (this.AttachmentViewModel.FixedFrame != null)
      return;
    this.RotatingSlidingAttachmentFrameBoxCtrl.Focus();
  }

  private void UpdateRotationAxisCombo(
    CApFLEXRotatingSlidingAttachmentRotationAxis rotationAxis)
  {
    bool flag = false;
    for (int index = 0; !flag && index < this.RotatingSlidingRotationAxisCombo.Items.Count; ++index)
    {
      if (this.RotatingSlidingRotationAxisCombo.Items[index] is CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem axisComboBoxItem && axisComboBoxItem.RotationAxis == rotationAxis)
      {
        this.RotatingSlidingRotationAxisCombo.SelectedItem = (object) axisComboBoxItem;
        flag = true;
      }
    }
  }

  private void RegisterNumericalControlEvents()
  {
    this.RotatingSlidingDistanceFromStartTxNumericEditBox.TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.RotatingSlidingDistanceFromStartTxNumericEditBox_TentativeValueChanged);
  }

  private void UnregisterNumericalControlEvents()
  {
    this.RotatingSlidingDistanceFromStartTxNumericEditBox.TentativeValueChanged -= new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.RotatingSlidingDistanceFromStartTxNumericEditBox_TentativeValueChanged);
  }

  public void UpdateAttachmentParametersWithParameters()
  {
    if (!this.IsControlActivated)
      return;
    this.AttachmentViewModel.Location = CApFLEXAttachmentLocation.AlongCable;
    this.AttachmentViewModel.FixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.SecondaryFixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.LengthFromStart = this.AttributeViewModel.Length * 0.5;
    this.AttachmentViewModel.RotatingSlidingRotationAxis = this.ParameterController.RotatingSlidingRotationAxis;
    this.UpdateRotationAxisCombo(this.AttachmentViewModel.RotatingSlidingRotationAxis);
  }

  public void UpdateAttachmentParametersWithAttachment(CApFLEXAttachment attachment)
  {
    if (!this.IsControlActivated)
      return;
    this.AttachmentViewModel.AttachmentType = attachment.AttachmentType;
    this.AttachmentViewModel.Location = CApFLEXAttachmentLocation.AlongCable;
    this.AttachmentViewModel.FixedFrame = attachment.FixedFrame;
    this.AttachmentViewModel.SecondaryFixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.LengthFromStart = attachment.LengthFromStart;
    this.AttachmentViewModel.RotatingSlidingRotationAxis = (attachment as CApFLEXRotatingSlidingAttachment).RotationAxis;
    this.UpdateRotationAxisCombo(this.AttachmentViewModel.RotatingSlidingRotationAxis);
  }

  public void SetDefaultFocus()
  {
    if (!this.IsControlActivated)
      return;
    this.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Delegate) (() => this.RotatingSlidingAttachmentFrameBoxCtrl.Focus()));
    this.DoSetDefaultFocus();
  }

  private void DoSetDefaultFocus()
  {
    if (this.RotatingSlidingAttachmentFrameBoxCtrl.Text != "")
      CApCableUtility.HighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.IsZoomPanelVisible = true;
    this.AttachmentViewModel.AttachmentFrameSelected = true;
  }

  private void SetBindings()
  {
    this.SetZoomPanelToVisibilityBindings();
    this.SetPreviewToVisibilityBindings();
    this.SetRotationAxisToVisibilityBindings();
    this.SetRotationAxisToBrushBindings();
  }

  private void SetZoomPanelToVisibilityBindings()
  {
    Binding binding = new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsZoomPanelVisible", Array.Empty<object>()),
      Converter = (IValueConverter) new BooleanToDiagramVisibilityConverter()
    };
    this.AttachmentFrameZoomHitBoxRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.RotationAxisZoomHitBoxRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.BackgroundLayerRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentAxesZoomPanelRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentAxesFrameIndicationRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentAxesDiagramIndicationRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
  }

  private void SetPreviewToVisibilityBindings()
  {
    Binding binding1 = new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsPreviewIdle", Array.Empty<object>()),
      Converter = (IValueConverter) new BooleanToDiagramVisibilityConverter()
    };
    this.AttachmentZArrowRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding1);
    this.HitBoxesRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding1);
    MultiBinding binding2 = new MultiBinding()
    {
      Converter = (IMultiValueConverter) new MultipleBooleanToDiagramVisibilityConverter()
    };
    binding2.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("RotatingSlidingAttachmentEditorViewModel.IsZoomPanelVisible", Array.Empty<object>())
    });
    binding2.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsPreviewIdle", Array.Empty<object>())
    });
    this.StartFramePointerRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.StartFrameAxesRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.StartFrameLabelRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.EndFramePointerRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.EndFrameAxesRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.EndFrameLabelRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.AttachmentFramePointerRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.AttachmentFrameAxesRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.AttachmentFrameLabelRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.DistanceFromStartPathRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.DistanceFromStartPointerRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.DistanceFromStartLabelRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    this.DistanceFromStartFocusRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding2);
    MultiBinding binding3 = new MultiBinding()
    {
      Converter = (IMultiValueConverter) new MultipleBooleanToDiagramVisibilityReverseConverter()
    };
    binding3.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("RotatingSlidingAttachmentEditorViewModel.IsZoomPanelVisible", Array.Empty<object>())
    });
    binding3.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsPreviewIdle", Array.Empty<object>())
    });
    this.RotationArrowRotatingSliding.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding3);
  }

  private void SetRotationAxisToVisibilityBindings()
  {
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter1 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter1.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisLineRotatingSliding, converter1);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisArrowRotatingSliding, converter1);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter2 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter2.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    converter2.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter2.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter2.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.DuringPreview);
    converter2.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.DuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisForegroundRotatingSliding, converter2);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter3 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter3.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    converter3.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter3.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisBackgroundRotatingSliding, converter3);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter4 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter4.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisLineRotatingSliding, converter4);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisArrowRotatingSliding, converter4);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter5 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter5.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    converter5.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter5.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter5.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.DuringPreview);
    converter5.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.DuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisForegroundRotatingSliding, converter5);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter6 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter6.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    converter6.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter6.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisBackgroundRotatingSliding, converter6);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter7 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter7.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentZAxisEllipticalArrowRotatingSliding, converter7);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter8 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter8.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter8.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentAnyAxisLineRotatingSliding, converter8);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentAnyAxisArrowRotatingSliding, converter8);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter9 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter9.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    converter9.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter9.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter9.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, PreviewVisibility.NotDuringPreview);
    converter9.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, PreviewVisibility.NotDuringPreview);
    converter9.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.NotDuringPreview);
    converter9.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisLabelRotatingSliding, converter9);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter10 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter10.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    converter10.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter10.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter10.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, PreviewVisibility.NotDuringPreview);
    converter10.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, PreviewVisibility.NotDuringPreview);
    converter10.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.NotDuringPreview);
    converter10.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisLabelRotatingSliding, converter10);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter11 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter11.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    converter11.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter11.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter11.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, PreviewVisibility.NotDuringPreview);
    converter11.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, PreviewVisibility.NotDuringPreview);
    converter11.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.NotDuringPreview);
    converter11.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYArrowRotatingSliding, converter11);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter12 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter12.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    converter12.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, Visibility.Visible);
    converter12.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, Visibility.Visible);
    converter12.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, PreviewVisibility.NotDuringPreview);
    converter12.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, PreviewVisibility.NotDuringPreview);
    converter12.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, PreviewVisibility.NotDuringPreview);
    converter12.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXArrowRotatingSliding, converter12);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter13 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter13.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, Visibility.Visible);
    converter13.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, PreviewVisibility.NotDuringPreview);
    converter13.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentXAxisEllipticalArrowRotatingSliding, converter13);
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter14 = new RotatingSlidingAttachmentRotationAxisToVisibilityConverter();
    converter14.AssignRegularVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, Visibility.Visible);
    converter14.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, PreviewVisibility.NotDuringPreview);
    converter14.AssignPreviewVisibilityToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, PreviewVisibility.NotDuringPreview);
    this.BindElementVisibilityToRotationAxis((FrameworkElement) this.AttachmentYAxisEllipticalArrowRotatingSliding, converter14);
  }

  private void SetRotationAxisToBrushBindings()
  {
    RotatingSlidingAttachmentRotationAxisToBrushConverter converter = new RotatingSlidingAttachmentRotationAxisToBrushConverter();
    converter.AssignBrushToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.X, (Brush) this.FindResource((object) "PLBloodRed6"));
    converter.AssignBrushToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Y, (Brush) this.FindResource((object) "PLGreen5"));
    converter.AssignBrushToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.Z, (Brush) this.FindResource((object) "PureBlack5"));
    converter.AssignBrushToRotationAxis(CApFLEXRotatingSlidingAttachmentRotationAxis.None, (Brush) this.FindResource((object) "PureBlack5"));
    this.BindElementStrokeToRotationAxis((FrameworkElement) this.RotationArrowLeftLineRotatingSliding, converter);
    this.BindElementStrokeToRotationAxis((FrameworkElement) this.RotationArrowLeftCapRotatingSliding, converter);
    this.BindElementStrokeToRotationAxis((FrameworkElement) this.RotationArrowRightLineRotatingSliding, converter);
    this.BindElementStrokeToRotationAxis((FrameworkElement) this.RotationArrowRightCapRotatingSliding, converter);
  }

  private void BindElementVisibilityToRotationAxis(
    FrameworkElement element,
    RotatingSlidingAttachmentRotationAxisToVisibilityConverter converter)
  {
    MultiBinding binding = new MultiBinding()
    {
      Converter = (IMultiValueConverter) converter
    };
    binding.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("AttachmentViewModel.RotatingSlidingRotationAxis", Array.Empty<object>())
    });
    binding.Bindings.Add((BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsPreviewRunning", Array.Empty<object>())
    });
    element.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
  }

  private void BindElementStrokeToRotationAxis(
    FrameworkElement element,
    RotatingSlidingAttachmentRotationAxisToBrushConverter converter)
  {
    element.SetBinding(Shape.StrokeProperty, (BindingBase) new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("AttachmentViewModel.RotatingSlidingRotationAxis", Array.Empty<object>()),
      Converter = (IValueConverter) converter
    });
  }

  public void SetEnabledAllParametersControls(bool isEnabled)
  {
    if (!isEnabled)
    {
      this.LastFocusedNumericBox = this.GetCurrentlyFocusedNumericBox();
      this.LastFocusedComboBox = this.GetCurrentlyFocusedComboBox();
    }
    this.RotatingSlidingAttachmentPanel.IsEnabled = isEnabled;
    if (!isEnabled)
      return;
    if (this.LastFocusedNumericBox != null)
    {
      ((UIElement) this.LastFocusedNumericBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
      this.LastFocusedNumericBox = (TxNumericEditBoxControl) null;
    }
    if (this.LastFocusedComboBox == null)
      return;
    this.LastFocusedComboBox.Focus();
    this.LastFocusedComboBox = (ComboBox) null;
  }

  private TxNumericEditBoxControl GetCurrentlyFocusedNumericBox()
  {
    TxNumericEditBoxControl focusedNumericBox = (TxNumericEditBoxControl) null;
    if (this.AttachmentViewModel.DistanceFromStartSelected)
      focusedNumericBox = this.RotatingSlidingDistanceFromStartTxNumericEditBox;
    return focusedNumericBox;
  }

  private ComboBox GetCurrentlyFocusedComboBox()
  {
    ComboBox currentlyFocusedComboBox = (ComboBox) null;
    if (this.AttachmentViewModel.RotationAxisSelected)
      currentlyFocusedComboBox = this.RotatingSlidingRotationAxisCombo;
    return currentlyFocusedComboBox;
  }

  public void DidDialogClose()
  {
    this.UnregisterNumericalControlEvents();
    this.AttachmentFrameUpdater.UnregisterEvents();
    this.LengthFromStartUpdater.UnregisterEvents();
    this.RotatingSlidingAttachmentFrameBoxCtrl.Picked -= new TxObjEditBoxCtrl_PickedEventHandler(this.AttachmentFrameEditBoxCtrl_Picked);
    ((UIElement) this.RotatingSlidingAttachmentFrameBoxCtrl).KeyUp -= new KeyEventHandler(this.RotatingSlidingAttachmentFrame_KeyUp);
    this.RotatingSlidingDistanceFromStartTxNumericEditBox = (TxNumericEditBoxControl) null;
  }

  private void AttachmentFrame_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    this.RotatingSlidingAttachmentFrameBoxCtrl.Focus();
  }

  private void AttachmentFrame_GotFocus(object sender, RoutedEventArgs e)
  {
    this.DoSetDefaultFocus();
  }

  private void AttachmentFrame_LostFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.IsZoomPanelVisible = false;
    this.AttachmentViewModel.AttachmentFrameSelected = false;
  }

  private void AttachmentFrame_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
  {
  }

  private void DistanceFromStart_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    ((UIElement) this.RotatingSlidingDistanceFromStartTxNumericEditBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
  }

  private void DistanceFromStart_GotFocus(object sender, RoutedEventArgs e)
  {
    this.IsZoomPanelVisible = false;
    this.AttachmentViewModel.DistanceFromStartSelected = true;
  }

  private void DistanceFromStart_LostFocus(object sender, RoutedEventArgs e)
  {
    this.IsZoomPanelVisible = false;
    this.AttachmentViewModel.DistanceFromStartSelected = false;
  }

  private void RotationAxis_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    this.RotatingSlidingRotationAxisCombo.Focus();
  }

  private void RotationAxis_GotFocus(object sender, RoutedEventArgs e)
  {
    this.IsZoomPanelVisible = true;
    this.AttachmentViewModel.RotationAxisSelected = true;
  }

  private void RotationAxis_LostFocus(object sender, RoutedEventArgs e)
  {
    this.IsZoomPanelVisible = false;
    this.AttachmentViewModel.RotationAxisSelected = false;
  }

  private void RotatingSlidingDistanceFromStartTxNumericEditBox_TentativeValueChanged(
    object sender,
    TxNumericEditBoxCtrl_TentativeValueChangedEventArgs args)
  {
    if (this.IsControlLoading || !this.IsControlActivated)
      return;
    this.LengthFromStartUpdater.SetLengthFromStart(args.TentativeValue * TxApplication.Options.Units.LinearMultiplier);
    this.ParameterChanged();
  }

  private void RotatingSlidingRotationAxis_SelectionChanged(
    object sender,
    SelectionChangedEventArgs e)
  {
    if (this.RotatingSlidingRotationAxisCombo.SelectedItem != null)
      this.AttachmentViewModel.RotatingSlidingRotationAxis = (this.RotatingSlidingRotationAxisCombo.SelectedItem as CApCableRotatingSlidingAttachmentRotationAxisComboBoxItem).RotationAxis;
    else
      this.UpdateRotationAxisCombo(this.AttachmentViewModel.RotatingSlidingRotationAxis);
  }

  private void AttachmentFrameEditBoxCtrl_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.AttachmentFrameUpdater.SetAttachmentFrame(this.RotatingSlidingAttachmentFrameBoxCtrl.Object as ITxLocatableObject);
  }

  private void RotatingSlidingAttachmentFrame_KeyUp(object sender, KeyEventArgs e)
  {
    if (e.Key != Key.Back && e.Key != Key.Delete)
      return;
    this.AttachmentFrameUpdater.UnsetAttachmentFrame();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/flexibles/attachmentcontrols/capcablerotatingslidingattachmentcontrol.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        this.RotatingSlidingAttachmentBorder = (Border) target;
        break;
      case 2:
        this.CanvasRotatingSlidingAttachment = (Canvas) target;
        break;
      case 3:
        this.BackgroundLayerRotatingSliding = (Path) target;
        break;
      case 4:
        this.EndFrameAxesRotatingSliding = (Canvas) target;
        break;
      case 5:
        this.EndFramePointerRotatingSliding = (Canvas) target;
        break;
      case 6:
        this.EndFrameLabelRotatingSliding = (TextBlock) target;
        break;
      case 7:
        this.StartFrameAxesRotatingSliding = (Canvas) target;
        break;
      case 8:
        this.StartFramePointerRotatingSliding = (Canvas) target;
        break;
      case 9:
        this.StartFrameLabelRotatingSliding = (TextBlock) target;
        break;
      case 10:
        this.AttachmentFramePointerRotatingSliding = (Canvas) target;
        break;
      case 11:
        this.AttachmentFrameLabelRotatingSliding = (TextBlock) target;
        break;
      case 12:
        this.AttachmentFrameAxesRotatingSliding = (Canvas) target;
        break;
      case 13:
        this.AttachmentXAxisLineRotatingSliding = (Path) target;
        break;
      case 14:
        this.AttachmentXAxisArrowRotatingSliding = (Path) target;
        break;
      case 15:
        this.AttachmentYAxisLineRotatingSliding = (Path) target;
        break;
      case 16 /*0x10*/:
        this.AttachmentYAxisArrowRotatingSliding = (Path) target;
        break;
      case 17:
        this.AttachmentAnyAxisLineRotatingSliding = (Path) target;
        break;
      case 18:
        this.AttachmentAnyAxisArrowRotatingSliding = (Path) target;
        break;
      case 19:
        this.CableSimulatedSection1RotatingSliding = (Path) target;
        break;
      case 20:
        this.CableSimulatedSection2RotatingSliding = (Path) target;
        break;
      case 21:
        this.RotationArrowRotatingSliding = (Grid) target;
        break;
      case 22:
        this.RotationArrowLeftLineRotatingSliding = (Path) target;
        break;
      case 23:
        this.RotationArrowLeftCapRotatingSliding = (Path) target;
        break;
      case 24:
        this.RotationArrowRightLineRotatingSliding = (Path) target;
        break;
      case 25:
        this.RotationArrowRightCapRotatingSliding = (Path) target;
        break;
      case 26:
        this.DistanceFromStartFocusRotatingSliding = (Path) target;
        break;
      case 27:
        this.DistanceFromStartPathRotatingSliding = (Path) target;
        break;
      case 28:
        this.DistanceFromStartPointerRotatingSliding = (Canvas) target;
        break;
      case 29:
        this.DistanceFromStartLabelRotatingSliding = (TextBlock) target;
        break;
      case 30:
        this.AttachmentGraphicObjectRotatingSliding = (Rectangle) target;
        break;
      case 31 /*0x1F*/:
        this.AttachmentAxesZoomPanelRotatingSliding = (Canvas) target;
        break;
      case 32 /*0x20*/:
        this.AttachmentAxesFrameIndicationRotatingSliding = (Canvas) target;
        break;
      case 33:
        this.AttachmentAxesDiagramIndicationRotatingSliding = (Canvas) target;
        break;
      case 34:
        this.AttachmentXAxisBackgroundRotatingSliding = (Path) target;
        break;
      case 35:
        this.AttachmentYAxisBackgroundRotatingSliding = (Path) target;
        break;
      case 36:
        this.MiniCableBackgroundEllipseBackRotatingSliding = (Ellipse) target;
        break;
      case 37:
        this.MiniCableHolderBackRotatingSliding = (Ellipse) target;
        break;
      case 38:
        this.MiniCableShapeFillerRotatingSliding = (Path) target;
        break;
      case 39:
        this.MiniCableRightEdgeRotatingSliding = (Path) target;
        break;
      case 40:
        this.MiniCableLeftEdgeRotatingSliding = (Path) target;
        break;
      case 41:
        this.MiniCableHolderFrontRotatingSliding = (Ellipse) target;
        break;
      case 42:
        this.MiniCableBackgroundEllipseFrontRotatingSliding = (Ellipse) target;
        break;
      case 43:
        this.MiniCableForegroundEllipseRotatingSliding = (Ellipse) target;
        break;
      case 44:
        this.AttachmentZAxisEllipticalArrowRotatingSliding = (Canvas) target;
        break;
      case 45:
        this.MiniCableForegroundEllipticalArrowRotatingSliding = (Ellipse) target;
        break;
      case 46:
        this.MiniCableForegroundEllipticalArrowStartTipRotatingSliding = (Path) target;
        break;
      case 47:
        this.MiniCableForegroundEllipticalArrowEndTipRotatingSliding = (Path) target;
        break;
      case 48 /*0x30*/:
        this.AttachmentXAxisForegroundRotatingSliding = (Canvas) target;
        break;
      case 49:
        this.AttachmentXAxisEllipticalArrowRotatingSliding = (Canvas) target;
        break;
      case 50:
        this.AttachmentYAxisForegroundRotatingSliding = (Canvas) target;
        break;
      case 51:
        this.AttachmentYAxisEllipticalArrowRotatingSliding = (Canvas) target;
        break;
      case 52:
        this.AttachmentXArrowRotatingSliding = (Canvas) target;
        break;
      case 53:
        this.AttachmentXAxisLabelRotatingSliding = (TextBlock) target;
        break;
      case 54:
        this.AttachmentYArrowRotatingSliding = (Canvas) target;
        break;
      case 55:
        this.AttachmentYAxisLabelRotatingSliding = (TextBlock) target;
        break;
      case 56:
        this.AttachmentZArrowRotatingSliding = (Canvas) target;
        break;
      case 57:
        this.HitBoxesRotatingSliding = (Canvas) target;
        break;
      case 58:
        this.DistanceFromStartHitBoxRotatingSliding = (Canvas) target;
        this.DistanceFromStartHitBoxRotatingSliding.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.DistanceFromStart_DiagramFocus);
        break;
      case 59:
        this.AttachmentFrameHitBoxRotatingSliding = (Canvas) target;
        this.AttachmentFrameHitBoxRotatingSliding.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.AttachmentFrame_DiagramFocus);
        break;
      case 60:
        this.AttachmentFrameZoomHitBoxRotatingSliding = (Path) target;
        break;
      case 61:
        this.RotationAxisHitBoxRotatingSliding = (Canvas) target;
        this.RotationAxisHitBoxRotatingSliding.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.RotationAxis_DiagramFocus);
        break;
      case 62:
        this.RotationAxisZoomHitBoxRotatingSliding = (Rectangle) target;
        break;
      case 63 /*0x3F*/:
        this.RotatingSlidingAttachmentPanel = (StackPanel) target;
        break;
      case 64 /*0x40*/:
        this.RotatingSlidingAttachmentGrid = (Grid) target;
        break;
      case 65:
        this.RotatingSlidingAttachmentFrameLabel = (TextBlock) target;
        break;
      case 66:
        this.RotatingSlidingAttachmentFrameBoxCtrl = (TxObjEditBoxControl) target;
        ((UIElement) this.RotatingSlidingAttachmentFrameBoxCtrl).GotFocus += new RoutedEventHandler(this.AttachmentFrame_GotFocus);
        ((UIElement) this.RotatingSlidingAttachmentFrameBoxCtrl).LostFocus += new RoutedEventHandler(this.AttachmentFrame_LostFocus);
        ((UIElement) this.RotatingSlidingAttachmentFrameBoxCtrl).IsEnabledChanged += new DependencyPropertyChangedEventHandler(this.AttachmentFrame_IsEnabledChanged);
        break;
      case 67:
        this.RotatingSlidingDistanceFromStartLabel = (TextBlock) target;
        break;
      case 68:
        this.RotatingSlidingDistanceFromStartTxNumericEditBox = (TxNumericEditBoxControl) target;
        ((UIElement) this.RotatingSlidingDistanceFromStartTxNumericEditBox).GotFocus += new RoutedEventHandler(this.DistanceFromStart_GotFocus);
        ((UIElement) this.RotatingSlidingDistanceFromStartTxNumericEditBox).LostFocus += new RoutedEventHandler(this.DistanceFromStart_LostFocus);
        break;
      case 69:
        this.RotatingSlidingRotationAxisLabel = (TextBlock) target;
        break;
      case 70:
        this.RotatingSlidingRotationAxisCombo = (ComboBox) target;
        this.RotatingSlidingRotationAxisCombo.SelectionChanged += new SelectionChangedEventHandler(this.RotatingSlidingRotationAxis_SelectionChanged);
        this.RotatingSlidingRotationAxisCombo.GotFocus += new RoutedEventHandler(this.RotationAxis_GotFocus);
        this.RotatingSlidingRotationAxisCombo.LostFocus += new RoutedEventHandler(this.RotationAxis_LostFocus);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
